package week04.homework01MazeGame.model.role;

import week04.homework01MazeGame.settings.MonsterGrowth;

import java.util.Random;

/**
 * @author li
 */
public class Monster extends BaseRole {

    private final int exp;

    private final int level;

    private static final Random RANDOM = new Random();

    private final MonsterGrowth growth;

    /**
     * 构造函数，初始化怪物的基本属性
     */
    public Monster(MonsterGrowth growth, int level) {
        super(
                level * (RANDOM.nextInt(1, growth.getHealthGrowth() + 1)),
                level * (RANDOM.nextInt(growth.getDefenseGrowth() + 1)),
                level * (RANDOM.nextInt(growth.getAttackGrowth() + 1))
        );
        this.growth = growth;
        this.exp = level * growth.getExpGrowth();
        this.level = level;
    }

    public int getExp() {
        return exp;
    }

    @Override
    public void showMessage() {
        System.out.println("****怪物的状态：****");
        System.out.println("生命值：" + getHealth());
        System.out.println("防御力：" + getDefense());
        System.out.println("攻击力：" + getAttack());
        System.out.println("等级：" + level);
        System.out.println("******************");
    }

    public MonsterGrowth getGrowth() {
        return growth;
    }
}
